home *** CD-ROM | disk | FTP | other *** search
Text File | 1996-04-04 | 2.2 KB | 85 lines | [TEXT/KAHL] |
- /********************************************************* DEFINITION
- DATE: 9/17/93
- AUTHOR: Eric R. Rosé
-
- CLASS: CPPSpawnZoneTask
-
- SUPERCLASS: CPPPeriodicTask
-
- This C++ class periodically spawns a ScanZoneTask
-
- ********************************************************************/
-
- #include <CPPTaskManager.h>
- #include <CPPStringList.h>
- #include "CPPSpawnZoneTask.h"
- #include "CPPScanZones.h"
-
- /*-----------------------------------------------------------------*/
- /*------------------------ PUBLIC METHODS -------------------------*/
- /*-----------------------------------------------------------------*/
-
- CPPSpawnZoneTask::CPPSpawnZoneTask (CPPTaskManager *TaskManager,
- long minPeriod,
- Boolean deleteWhenDone) :
- CPPPeriodicTask (TaskManager, minPeriod,
- deleteWhenDone)
- {
- this->scanTask = NULL;
- }
-
- /*-----------------------------------------------------------------*/
-
- CPPSpawnZoneTask::~CPPSpawnZoneTask (void)
- {
- if (this->scanTask)
- delete this->scanTask;
- }
-
- /*-----------------------------------------------------------------*/
-
- char *CPPSpawnZoneTask::ClassName (void)
- {
- return "CPPSpawnZoneTask";
- }
-
- /*-----------------------------------------------------------------*/
-
- void CPPSpawnZoneTask::DoPeriodicAction (void)
- /* if the Scan task has completed, ask it to scan again; */
- /* NOTE: this task never completes */
- {
- // call the inherited method to update frequency count
- CPPPeriodicTask::DoPeriodicAction();
-
- if (scanTask->hasCompleted)
- scanTask->StartScanZones (NULL);
- }
-
- /*-----------------------------------------------------------------*/
-
- void CPPSpawnZoneTask::DoCompletedAction (void)
- {
- CPPPeriodicTask::DoCompletedAction();
- }
-
- /*-----------------------------------------------------------------*/
-
- void CPPSpawnZoneTask::StartSpawnZoneTask
- (CompletionProc DoProc)
- {
- if (!this->hasCompleted)
- return;
-
- // get rid of the old lookup and zone data (if any)
- if (!scanTask)
- scanTask = new CPPScanZones (this->ourManager, 60, FALSE);
-
- // note that we haven't completed yet
- SetCompletionProc(DoProc);
- this->hasCompleted = FALSE;
-
- // add ourselves to the periodic task queue
- this->ourManager->AddPeriodicTask(this);
- }
-